# 参数默认值
# 默认值设置倒着
def get_total(a=0, b=0, c=0):
    print(a + b + c)

# get_total(6000, 3000, 500)
# get_total(6000, 3000)
# get_total(6000)
# get_total()

# 编写一个数据连接函数
def mysql_get_connect(host='127.0.0.1', port=3306, username='root', password=''):
    pass
# mysql_get_connect(username='abc', password='123456')


# 传递的参数数量不确定的
# 接收不确定数量的位置参数 *, 格式为元组
def add(*args):
    # print(args)
    # 求和
    total = 0
    for i in args:
        total += i
    print(total)
# add(28, 45)
# add(39, 47, 88, 61, 52)
# add(1, 2, 3, 4, 5, 6, 7, 8)
# **kwargs 接收不确定数量的关键字参数，格式是字典
def fn(**kwargs):
    # print(kwargs)
    # 求和
    total = 0
    for k in kwargs:
        # print(k, kwargs[k])
        total += kwargs[k]
    print(total)
# 传递的是不确定的关键字参数
# fn(chinese=82, math=94, english=88, history=93)
# fn(chinese=82, math=94, english=88, xxx=93)
# fn(a=99, b=100, c=52, d=66)


def fun(*args, **kwargs):
    # print(args, kwargs)
    total = 0
    for i in args:
       total += i
    for k in kwargs:
        total += kwargs[k]
    print(total)

fun(1, 2, 3, 4, a=5, b=6, c=7)









